﻿using Styx.Common;
using Styx.WoWInternals;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Media;
using System.Drawing;

namespace SinisterD.Core.Managers
{
    class Hotkey_Manager
    {
        public static bool aoeOn { get; set; }
        public static bool cooldownsOn { get; set; }
        public static bool manualOn { get; set; }
        public static bool FeintOn { get; set; }
        public static bool KSon { get; set; }
        public static bool ambushOn { get; set; }
        public static bool healOn { get; set; }
        public static bool vanishPrepOn { get; set; }
        public static bool keysRegistered { get; set; }

        #region [Method] - Hotkey Registration
        public static void registerHotKeys()
        {
            if (keysRegistered)
                return;
            HotkeysManager.Register("healOn", Keys.NumPad1, ModifierKeys.Control, ret =>
            {
                healOn = !healOn;
                Lua.DoString(healOn ? @"print('Self Heal Mode: \124cFF15E61C Enabled!')" : @"print('Self Heal Mode: \124cFFE61515 Disabled!')");
            });
            HotkeysManager.Register("vanishPrepOn", Keys.NumPad0, ModifierKeys.Control, ret =>
            {
                vanishPrepOn = !vanishPrepOn;
                Lua.DoString(vanishPrepOn ? @"print('Using Vanish/Prep: \124cFF15E61C Enabled!')" : @"print('Using Vanish/Prep: \124cFFE61515 Disabled!')");
            });
            HotkeysManager.Register("ambushOn", Keys.NumPad3, ModifierKeys.Control, ret =>
            {
                ambushOn = !ambushOn;
                Lua.DoString(ambushOn ? @"print('Non-Combat Ambush : \124cFF15E61C Enabled!')" : @"print('Non-Combat Ambush: \124cFFE61515 Disabled!')");
            });
            HotkeysManager.Register("aoeOn", Keys.E, ModifierKeys.Alt, ret =>
            {
                aoeOn = !aoeOn;
                Lua.DoString(aoeOn ? @"print('AoE Mode: \124cFF15E61C Enabled!')" : @"print('AoE Mode: \124cFFE61515 Disabled!')");
            });
            HotkeysManager.Register("cooldownsOn", Keys.Q, ModifierKeys.Alt, ret =>
            {
                cooldownsOn = !cooldownsOn;
                Lua.DoString(cooldownsOn ? @"print('Cooldowns: \124cFF15E61C Enabled!')" : @"print('Cooldowns: \124cFFE61515 Disabled!')");
            });
            HotkeysManager.Register("manualOn", Keys.G, ModifierKeys.Alt, ret =>
            {
                manualOn = !manualOn;
                Lua.DoString(manualOn ? @"print('Manual Mode: \124cFF15E61C Enabled!')" : @"print('Manual Mode: \124cFFE61515 Disabled!')");
            });
            HotkeysManager.Register("FeintOn", Keys.F, ModifierKeys.Alt, ret =>
            {
                FeintOn = !FeintOn;
                Lua.DoString(FeintOn ? @"print('Feint Mode: \124cFF15E61C Enabled!')" : @"print('Feint Mode: \124cFFE61515 Disabled!')");
            });
            HotkeysManager.Register("KSon", Keys.Q, ModifierKeys.Control, ret =>
            {
                KSon = !KSon;
                Lua.DoString(KSon ? @"print('Killing Spree: \124cFF15E61C Enabled!')" : @"print('Killing Spree: \124cFFE61515 Disabled!')");
            });
            keysRegistered = true;
            Lua.DoString(@"print('Hotkeys: \124cFF15E61C Registered!')");

            Logging.Write(Colors.OrangeRed, "Hotkeys: Registered!");
        }  
        #endregion

        #region [Method] - Hotkey Removal
        public static void removeHotkeys()
        {
            if (!keysRegistered)
                return;
            HotkeysManager.Unregister("aoeOn");
            HotkeysManager.Unregister("cooldownsOn");
            HotkeysManager.Unregister("manualOn");
            HotkeysManager.Unregister("FeintOn");
            HotkeysManager.Unregister("KSon");
            aoeOn = false;
            cooldownsOn = false;
            manualOn = false;
            FeintOn = false;
            KSon = false;
            keysRegistered = false;
            Lua.DoString(@"print('Hotkeys: \124cFFE61515 Removed!')");
            Logging.Write(Colors.OrangeRed, "Hotkeys: Removed!");
        } 
        #endregion 
    }
}
